<html>
<head><meta charset="utf-8"><title>Pre-RFC: Checking validity of #[cfg] · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html">Pre-RFC: Checking validity of #[cfg]</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="215615513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215615513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Arlie Davis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215615513">(Nov 04 2020 at 17:34)</a>:</h4>
<p>Hello, folks. I've been working on an RFC for a feature change to <code>rustc</code>. Is this the right place to start a pre-RFC discussion? Here's the link to my RFC:</p>
<p><a href="https://github.com/sivadeilra/rfcs/blob/user/ardavis/checked_cfg/text/0000-conditional-compilation-checking.md">https://github.com/sivadeilra/rfcs/blob/user/ardavis/checked_cfg/text/0000-conditional-compilation-checking.md</a></p>
<p>From the summary:</p>
<p>Rust supports conditional compilation, analogous to <code>#ifdef</code> in C / C++ / C#. Experience has shown<br>
that managing conditional compilation is a significant burden for large-scale development. One of<br>
the risks is that a condition may contain misspelled identifiers, or may use identifiers that are<br>
obsolete or have been removed from a product. For example:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="cp">#[cfg(feature = </span><span class="s">"widnows"</span><span class="cp">)]</span><span class="w"></span>
<span class="k">fn</span> <span class="nf">do_windows_thing</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="cm">/* ... */</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>The developer intended to test for the feature named <code>windows</code>. This could easily have been detected<br>
by <code>rustc</code> if it had known the set of all valid <code>feature</code> flags, not only the ones currently<br>
enabled.</p>
<p>This RFC proposes adding new command-line options to <code>rustc</code>, which will allow Cargo (and other<br>
build tools) to inform <code>rustc</code> of the set of valid feature flags. Using conditions that are not<br>
valid will cause a diagnostic warning. This feature is opt-in, for backwards compatibility;<br>
if no valid configuration options are presented to <code>rustc</code> then no warnings are generated.</p>



<a name="215615946"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215615946" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215615946">(Nov 04 2020 at 17:37)</a>:</h4>
<p><span class="user-mention" data-user-id="274471">@Arlie Davis</span> if you want to get preliminary feedback, <a href="https://internals.rust-lang.org/">https://internals.rust-lang.org/</a> is a good place. Otherwise if you think it's ready for review by community, you'd make a PR to the RFCs repo: <a href="https://github.com/rust-lang/rfcs/#what-the-process-is">https://github.com/rust-lang/rfcs/#what-the-process-is</a></p>



<a name="215616210"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215616210" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Arlie Davis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215616210">(Nov 04 2020 at 17:40)</a>:</h4>
<p>Ok, good to know. This is not a complex feature, and partly my goal is just to become familiar with the process of writing RFCs, working with reviewers, and landing feature changes.</p>
<p>This doc has been reviewed internally by my team within Microsoft, so I think it's reasonably self-coherent. Does that meet the bar for just opening a PR to the RFCs repo?  Or is it expected that there's always some discussion, somewhere, before that?</p>



<a name="215616331"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215616331" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215616331">(Nov 04 2020 at 17:41)</a>:</h4>
<p>If you think it's good to go, feel free to open an RFC directly :)</p>



<a name="215616810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215616810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Arlie Davis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215616810">(Nov 04 2020 at 17:45)</a>:</h4>
<p><a href="https://github.com/rust-lang/rfcs/pull/3013">https://github.com/rust-lang/rfcs/pull/3013</a>, if anyone is interested.</p>



<a name="215641214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215641214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pachi <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215641214">(Nov 04 2020 at 21:04)</a>:</h4>
<p><span class="user-mention" data-user-id="274471">@Arlie Davis</span> in the PR message people usually put a link to a rendered version to ease reading and feedback. You can see how it is done in other PRs.</p>



<a name="215649151"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215649151" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215649151">(Nov 04 2020 at 22:27)</a>:</h4>
<p>(I've added a Rendered link.)</p>



<a name="215686470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215686470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215686470">(Nov 05 2020 at 09:15)</a>:</h4>
<p><span class="user-mention" data-user-id="274471">@Arlie Davis</span> <span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="215686545"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215686545" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215686545">(Nov 05 2020 at 09:15)</a>:</h4>
<p>Always good to have extra checks like this to prevent problems on platforms other than the ones the developer uses most of the time.</p>



<a name="215686633"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215686633" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215686633">(Nov 05 2020 at 09:16)</a>:</h4>
<p>If this is something you run into, you might also find the portability lint helpful. Already approved, just needs implementation.</p>



<a name="215741985"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215741985" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Arlie Davis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215741985">(Nov 05 2020 at 17:01)</a>:</h4>
<p>Ah, the portability lint RFC is interesting -- I was unaware of it. I'm going to see how much overlap there is with my RFC.</p>



<a name="215768396"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215768396" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215768396">(Nov 05 2020 at 20:17)</a>:</h4>
<p><span class="user-mention" data-user-id="274471">@Arlie Davis</span> I've wanted that lint implemented for a <em>long</em> time. I'm not aware of other languages or similar having anything like it, and it would go a <em>long</em> way towards helping people who write code on one platform become aware of issues that may only occur on other platforms.</p>



<a name="215768471"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215768471" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215768471">(Nov 05 2020 at 20:18)</a>:</h4>
<p>Which I think would benefit Windows quite a bit.</p>



<a name="215769329"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215769329" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Arlie Davis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215769329">(Nov 05 2020 at 20:26)</a>:</h4>
<p>Absolutely.  I'm especially interested in it for things like sanely representing SIMD/SSE capabilities.</p>



<a name="215782863"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215782863" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Poliorcetics <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215782863">(Nov 05 2020 at 22:32)</a>:</h4>
<p><span class="user-mention" data-user-id="239881">@Josh Triplett</span> I believe Apple has « @available » in Swift for portability which does something similar, though I’m no expert on the subject</p>



<a name="215793135"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215793135" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215793135">(Nov 06 2020 at 00:47)</a>:</h4>
<p><span class="user-mention" data-user-id="307289">@Poliorcetics</span> <a href="https://rust-lang.github.io/rfcs/2523-cfg-path-version.html">https://rust-lang.github.io/rfcs/2523-cfg-path-version.html</a></p>



<a name="215813306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215813306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Poliorcetics <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215813306">(Nov 06 2020 at 07:34)</a>:</h4>
<p>Oh I didn’t know this existed !</p>



<a name="215899892"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215899892" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Arlie Davis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215899892">(Nov 06 2020 at 20:28)</a>:</h4>
<p>I have a prototype implemented, which adds two new lints, <code>invalid_cfg_name</code> and <code>invalid_cfg_value</code>. Everything works, except I can't suppress these with <code>#![allow(invalid_cfg_name)]</code>. So I'm trying to understand the diagnostics system better.</p>
<p>Since these errors are detected during the "early" phase of parsing, should I be using <code>ParseSess::buffer_lint</code>?  I tried using that, but I don't know when / where to catch the buffered lints, so the compiler is panicking later, when it finds that I haven't done anything with the buffered lints.</p>



<a name="215900442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215900442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Arlie Davis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215900442">(Nov 06 2020 at 20:34)</a>:</h4>
<p>Do I need to add something to an EarlyLintPass, to consume it?</p>



<a name="215900571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215900571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215900571">(Nov 06 2020 at 20:35)</a>:</h4>
<p>If you grep for the other uses of buffer lint, there should be a place where they're currently being re-emitted as proper lints.</p>



<a name="215900698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215900698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215900698">(Nov 06 2020 at 20:36)</a>:</h4>
<p><a href="https://github.com/Mark-Simulacrum/rust/blob/c279138ab6080e3c3d9b4300cd74b3eb059d0b77/compiler/rustc_lint/src/early.rs#L40-L48">https://github.com/Mark-Simulacrum/rust/blob/c279138ab6080e3c3d9b4300cd74b3eb059d0b77/compiler/rustc_lint/src/early.rs#L40-L48</a> looks relevant</p>



<a name="215901718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215901718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Arlie Davis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215901718">(Nov 06 2020 at 20:46)</a>:</h4>
<p>Yeah, I've been trying to track down exactly how that works.</p>



<a name="215901774"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215901774" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Arlie Davis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215901774">(Nov 06 2020 at 20:46)</a>:</h4>
<p>Is a buffered lint the right way to go?  Where does the #[allow] filtering get applied?</p>



<a name="215909242"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215909242" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215909242">(Nov 06 2020 at 21:58)</a>:</h4>
<p><span class="user-mention" data-user-id="274471">@Arlie Davis</span> so one hurdle might be that when dealing with cfg items, I'm not sure how lint levels are expected to work -- in particular, what if you invalidly cfg out the item the cfg is on?</p>



<a name="215909275"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215909275" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215909275">(Nov 06 2020 at 21:59)</a>:</h4>
<p>(Maybe I should read the RFC/pre-RFC)</p>



<a name="215909354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215909354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Arlie Davis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215909354">(Nov 06 2020 at 21:59)</a>:</h4>
<p>Well, the RFC doesn't change the behavior of <code>#[cfg]</code>. It only adds new lints. It's easiest to check those lints when evaluating <code>#[cfg]</code>, not as a separate / later pass.</p>



<a name="215910005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215910005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215910005">(Nov 06 2020 at 22:06)</a>:</h4>
<p>I just mean that lint emission on an attribute that is gone might not work, so we might be stuck sort of</p>



<a name="215910026"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215910026" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215910026">(Nov 06 2020 at 22:06)</a>:</h4>
<p>i.e., you can't really check if the lint level at that attribute is something because the attribute is gone by that point in the compiler</p>



<a name="215911885"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215911885" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Arlie Davis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215911885">(Nov 06 2020 at 22:29)</a>:</h4>
<p>Ah, right.  Would it work to attach them to the crate, instead?</p>



<a name="215912286"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215912286" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215912286">(Nov 06 2020 at 22:33)</a>:</h4>
<p>Perhaps, yeah. Not sure.</p>



<a name="215912366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215912366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215912366">(Nov 06 2020 at 22:34)</a>:</h4>
<p>Since these are always user-specified a hard lint might not be the worst idea -- presumably, users can just add it to the valid list if it's a problem</p>



<a name="215912386"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215912386" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215912386">(Nov 06 2020 at 22:34)</a>:</h4>
<p>(or hard warning but affected by cap-lints, ideally)</p>



<a name="215913970"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215913970" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Arlie Davis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215913970">(Nov 06 2020 at 22:51)</a>:</h4>
<p>Pardon my ignorance, but what's a hard lint?  Just a normal Ennn error?  That's easy enough to do, of course, but can users control those with <code>#[allow]</code>?</p>



<a name="215914016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215914016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215914016">(Nov 06 2020 at 22:51)</a>:</h4>
<p>I think <span class="user-mention" data-user-id="116122">@simulacrum</span> meant deny-by-default</p>



<a name="215914020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215914020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215914020">(Nov 06 2020 at 22:51)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="119031">@Esteban Küber</span> </p>
<p>Not quite. We would probably need to do something ad-hoc here, I guess</p>



<a name="215914031"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215914031" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215914031">(Nov 06 2020 at 22:52)</a>:</h4>
<p>as opposed to warn-by-default</p>



<a name="215914072"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215914072" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215914072">(Nov 06 2020 at 22:52)</a>:</h4>
<p>No, that's not what I meant</p>



<a name="215914156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215914156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215914156">(Nov 06 2020 at 22:53)</a>:</h4>
<p>e.g. we could span_warn, I believe, though perhaps conditionally</p>



<a name="215915254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215915254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Arlie Davis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215915254">(Nov 06 2020 at 23:04)</a>:</h4>
<p>Since this feature is opt-in to begin with, maybe an unconditional error is OK?</p>



<a name="215917083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215917083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215917083">(Nov 06 2020 at 23:28)</a>:</h4>
<p>yeah, maybe</p>



<a name="215917101"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215917101" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215917101">(Nov 06 2020 at 23:29)</a>:</h4>
<p>Definitely seems fine to start with</p>



<a name="215917125"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Pre-RFC%3A%20Checking%20validity%20of%20%23%5Bcfg%5D/near/215917125" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Arlie Davis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Pre-RFC.3A.20Checking.20validity.20of.20.23.5Bcfg.5D.html#215917125">(Nov 06 2020 at 23:29)</a>:</h4>
<p>That sure makes life easier for me.  :)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>